home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / jaxp.jar / javax / xml / parsers / SAXParser.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-02-23  |  1.9 KB  |  69 lines

  1. package javax.xml.parsers;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5. import java.io.InputStream;
  6. import org.xml.sax.HandlerBase;
  7. import org.xml.sax.InputSource;
  8. import org.xml.sax.Parser;
  9. import org.xml.sax.SAXException;
  10.  
  11. public abstract class SAXParser {
  12.    protected SAXParser() {
  13.    }
  14.  
  15.    public abstract Parser getParser() throws SAXException;
  16.  
  17.    public abstract boolean isNamespaceAware();
  18.  
  19.    public abstract boolean isValidating();
  20.  
  21.    public void parse(File var1, HandlerBase var2) throws SAXException, IOException {
  22.       if (var1 == null) {
  23.          throw new IllegalArgumentException("File cannot be null");
  24.       } else {
  25.          String var3 = "file:" + var1.getAbsolutePath();
  26.          if (File.separatorChar == '\\') {
  27.             var3 = var3.replace('\\', '/');
  28.          }
  29.  
  30.          InputSource var4 = new InputSource(var3);
  31.          this.parse(var4, var2);
  32.       }
  33.    }
  34.  
  35.    public void parse(InputStream var1, HandlerBase var2) throws SAXException, IOException {
  36.       if (var1 == null) {
  37.          throw new IllegalArgumentException("InputStream cannot be null");
  38.       } else {
  39.          InputSource var3 = new InputSource(var1);
  40.          this.parse(var3, var2);
  41.       }
  42.    }
  43.  
  44.    public void parse(String var1, HandlerBase var2) throws SAXException, IOException {
  45.       if (var1 == null) {
  46.          throw new IllegalArgumentException("uri cannot be null");
  47.       } else {
  48.          InputSource var3 = new InputSource(var1);
  49.          this.parse(var3, var2);
  50.       }
  51.    }
  52.  
  53.    public void parse(InputSource var1, HandlerBase var2) throws SAXException, IOException {
  54.       if (var1 == null) {
  55.          throw new IllegalArgumentException("InputSource cannot be null");
  56.       } else {
  57.          Parser var3 = this.getParser();
  58.          if (var2 != null) {
  59.             var3.setDocumentHandler(var2);
  60.             var3.setEntityResolver(var2);
  61.             var3.setErrorHandler(var2);
  62.             var3.setDTDHandler(var2);
  63.          }
  64.  
  65.          var3.parse(var1);
  66.       }
  67.    }
  68. }
  69.